package com.tbs.parkingsaleapp.UI.Listenners;

import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import com.tbs.parkingsaleapp.R;
import com.tbs.parkingsaleapp.UI.Adapters.DiscountAdapter;
import com.tbs.parkingsaleapp.UI.DiscountApplyActivity;

public class DiscountCheckedListenner implements AdapterView.OnItemClickListener{

    private Context context;

    public DiscountCheckedListenner(Context context)
    {
        this.context=context;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

        DiscountApplyActivity.getInstance().setTime(0);
        DiscountApplyActivity.getInstance().btn.setEnabled(true);
        boolean z= (boolean) view.getTag();
        view.setTag(!z);
        if(!z)
        {
            DiscountApplyActivity.CheckItem(position);
            view.setBackground(context.getDrawable(R.drawable.check_discount));
        }

        else
        {
            DiscountApplyActivity.UncheckItem(position);
            view.setBackground(context.getDrawable(R.drawable.uncheck_discount));
        }

    }
}
